package com.triones.api.controller.api;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.page.TableDataInfo;
import com.triones.api.entity.vo.ApiCustomNoticeVO;
import com.triones.api.service.NoticeService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * api - 用户会员相关接口
 *
 * @Author: triones
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/api/notice")
public class ApiNoticeController extends BaseController {

    private final NoticeService noticeService;

    /**
     * 通知列表（分页）
     */
    @GetMapping(value = "/list")
    public R<List<ApiCustomNoticeVO>> apiPageList() {
        return R.ok(noticeService.apiList());
    }

    /**
     * 通知详情
     */
    @GetMapping(value = "/{id}")
    public R<ApiCustomNoticeVO> apiGetNoticeInfoById(@PathVariable Long id) {
        return R.ok(noticeService.apiGetNoticeInfoById(id));
    }

    /**
     * 通知已读
     */
    @DeleteMapping("/{ids}")
    public R<Void> noticeRead(@PathVariable Long[] ids) {
        return toAjax(noticeService.noticeRead(ids));
    }
}
